import request from '@/utils/request'

export function setUserIsAdmin(userId, tenantId) {
  return request({
    url: '/b/tenant/setUserIsAdmin',
    method: 'PUT',
    data: {
      userId,
      tenantId,
      isAdmin: true
    }
  })
}

// 查询租户管理列表
export function listTenant(query) {
  return request({
    url: '/b/tenant/list',
    method: 'get',
    params: query
  })
}

// 查询租户管理详细
export function getTenant(id) {
  return request({
    url: '/b/tenant/' + id,
    method: 'get'
  })
}

// 新增租户管理
export function addTenant(data) {
  return request({
    url: '/b/tenant',
    method: 'post',
    data: data
  })
}

// 修改租户管理
export function updateTenant(data) {
  return request({
    url: '/b/tenant',
    method: 'put',
    data: data
  })
}

// 删除租户管理
export function delTenant(id) {
  return request({
    url: '/b/tenant/' + id,
    method: 'delete'
  })
}


export function getUserByTenant(query) {
  console.log(query)
  return request({
    url: '/b/tenantUser/tenant',
    method: 'get',
    params: query
  })
}
